<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
    </ul>
    <script>
        const ul = document.querySelector('ul')
        console.log(ul);
        const li1 = document.querySelector('li')
        console.log(li1);
        const li2 = document.querySelector('ul li:nth-child(2)')
        console.log(li2);
        const li3 = document.querySelector('ul li:last-child')
        console.log(li3);
        //依次写出 但是可以用for遍历
    </script>
</body>

</html>